package com.ruoyi.web.controller.park;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.param.ParkingSpaceParam;
import com.ruoyi.service.BizParkingSpaceService;
import com.ruoyi.service.ParkService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/park/space")
public class ParkController {

    @Autowired
    private ParkService parkService;
    @Autowired
    private BizParkingSpaceService bizParkingSpaceService;


    @GetMapping("/list")
    public AjaxResult parkSpaceList(){
        return AjaxResult.success("查询成功！",parkService.listAll());
    }

    @GetMapping
    public AjaxResult parkingSpace(ParkingSpaceParam parkingSpaceParam){
        return AjaxResult.success(bizParkingSpaceService.parkingSpaceList(parkingSpaceParam));
    }


    @ApiOperation(value = "处理单条同步失败")
    @Log(title = "同步列表", businessType = BusinessType.DELETE)
    @DeleteMapping("delete/{id}")
    public AjaxResult deleteParkSys(@PathVariable String id) throws Exception {
        return AjaxResult.success(parkService.deleteParkSys(id));
    }

    @ApiOperation(value = "同步成功后没有显示")
    @Log(title = "同步列表", businessType = BusinessType.DELETE)
    @DeleteMapping("deletes/{id}")
    public AjaxResult deletesParkSys(@PathVariable String id) throws Exception {
        return AjaxResult.success(parkService.parkSysPrice(id));
    }

    @ApiOperation(value = "无法上传指引图删除重复车位")
    @Log(title = "车位管理", businessType = BusinessType.DELETE)
    @DeleteMapping("deletespace/{id}")
    public AjaxResult deleteParkingSpace(@PathVariable String id) throws Exception {
        return AjaxResult.success(parkService.deleteParkingSpace(id));
    }

    /*@ApiOperation(value="删除多条车位记录")
    @Log(title = "车位管理", businessType = BusinessType.DELETE)
    @DeleteMapping("deletespaces/{id}")
    public AjaxResult deleteParkingSpaces(@PathVariable String id) throws Exception {
        return AjaxResult.success(parkService.deleteParkingSpaces(id));
    }*/
}
